/******************************************************************
*
* Copyright 2010 Darshan M Sonde
*
* This file is part of ddots.
*
* ddots is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ddots is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ddots.  If not, see <http://www.gnu.org/licenses/>.
*
*********************************************************************/

#ifndef GAMEAPP_H
#define GAMEAPP_H

#include "game.h"
#include "gamescene.h"
#include "dialog.h"
#include "gamegui.h"
#include "engineinterface.h"

#include <QtGui>

class GameApp : public QApplication
{
    Q_OBJECT
public:
    GameApp(int &argc,char **argv);

signals:
    void engineLoaded(const QString &name);

public slots:
    void showDialog();

    void newGame();
    void cancelDialog();

    void lineComplete(QPoint start,QPoint end);
    void toggleTurn();

protected slots:
    void updateTurn();
    void boxCompleteFlagSet();
protected:
    void loadPlugins();
    bool boxCompleted();
    bool checkGameWon();

private:    
    Dialog mDialog;
    GameGui mGui;
    GameScene* mScene;

    Player mCurrentTurn;
    EngineInterface *mPlayerOneEngine;//if 0 means human
    EngineInterface *mPlayerTwoEngine;// if 0 means human
    QHash<QString,EngineInterface*> mEngines;

    bool mBoxCompleted;
};

#endif

